


<!DOCTYPE html>
<!-- Website template by freewebsitetemplates.com -->
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
		<title>Grade Bay</title>
		<link rel="stylesheet" href="gui.css" type="text/css" />
		<!--[if IE 7]>
			<link rel="stylesheet" href="css/ie7.css" type="text/css" />
		<![endif]-->
	</head>
	<body>
		<div class="page">
			<div class="header">
				<a href="index.php" id="logo"><img src="images/gradeBaylogo.png" width="330" height="79" alt=""/></a>
				<ul>
					<li class="selected"><a href=""> EDIT TEACHER</a></li>
					<li><a href="viewTeachers.php">BACK</a></li>
			
				</ul>
			</div>
			<div class="body">
                            <div class="addsubject">
                           
                            
                            <?php

                            /*
                            * To change this template, choose Tools | Templates
                            * and open the template in the editor.
                            */
                                 include 'PHPClasses/DBAccess.php';
                                 include 'PHPClasses/TeacherDBAccess.php';
                                   
                                  
                                    if(!isset($_POST['teacherID'])){
                                        $teacherID=$_GET['teacherID'];

                                    }

                                    else{
                                        $teacherID=$_POST['teacherID'];

                                    }
                                 
                                 
                                  if(!isset($_GET['error'])){
                                        $_GET['error']=0;
                                    }

                                    if ($_GET['error']){ //If any errors display them  

                                        $errormsg = $_GET['error'] . ".<br>";
                                        echo "<p style='color:red;'>$errormsg</p>";

                                    }
                                    
                                    
                           
                                 $DBAccess=new TeacherDBAccess();
                                
                                 
                                 $teacherRow= $DBAccess->viewEditTeacher($teacherID);
                                 extract($teacherRow);

                                  echo "<form name='teacherIDForm' action='editTeacherDB.php' method='POST'>";
                                  echo "<table><tr><td><p>Name of Teacher:</p></td><td><input class='tf_effect' style='padding:0;' value='".$teacherName."' type='text' name='teacherName' /></td></tr></table>";
                                  echo "<p>In charge of Grades or Year Levels: </p> ";
                                  
                                 $geteacherlvl = $DBAccess->getTeacherLevelsFromDB($teacherID);
                                 
                                 $level=array();

                                 $i=0;
                                    while($row = mysql_fetch_array( $geteacherlvl)){

                                        extract($row);

                                        $level[$i]=$Level;
                                        $i++;
                                    }

                                    if(in_array('None',$level)==TRUE){
                                    echo "<p><input type='checkbox' type='text' name='level[]' value='None' checked/> None";
                                    }


                                    else{
                                        echo "<p><input type='checkbox' type='text' name='level[]' value='None'/> None";
                                    }

                                    if(in_array('Grade 1',$level)==TRUE){
                                    echo "<p><input type='checkbox' type='text' name='level[]' value='Grade 1' checked/> Grade 1";
                                    }

                                    else{
                                        echo "<p><input type='checkbox' type='text' name='level[]' value='Grade 1'/> Grade 1";
                                    }

                                    if(in_array('Grade 2',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='Grade 2' checked/> Grade 2";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='Grade 2'/> Grade 2";
                                    }

                                    if(in_array('Grade 3',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='Grade 3' checked/> Grade 3";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='Grade 3'/> Grade 3";
                                    }

                                    if(in_array('Grade 4',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='Grade 4' checked/> Grade 4";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='Grade 4'/> Grade 4";
                                    }


                                    if(in_array('Grade 5',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='Grade 5' checked/> Grade 5";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='Grade 5'/> Grade 5";
                                    }


                                    if(in_array('Grade 6',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='Grade 6' checked/> Grade 6";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='Grade 6'/>Grade 6<br/>";
                                    }

                                    if(in_array('1st Year',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='1st Year' checked/> 1st Year";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='1st Year'/> 1st Year";
                                    }



                                    if(in_array('2nd Year',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='2nd Year' checked/> 2nd Year";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='2nd Year'/>2nd Year";
                                    }



                                    if(in_array('3rd Year',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='3rd Year' checked/> 3rd Year";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='3rd Year' /> 3rd Year";
                                    }



                                    if(in_array('4th Year',$level)==TRUE){
                                    echo "<input type='checkbox' type='text' name='level[]' value='4th Year' checked/>4th Year</td></tr>  </p>";
                                    }

                                    else{
                                        echo "<input type='checkbox' type='text' name='level[]' value='4th Year'/>4th Year</td></tr>  </p>";
                                    }

                                    
                                    
                                    echo "<br><p>In charge of Subjects: </p> ";
                                   
                                    $subjects=$DBAccess->getSubjectsofTeacher($teacherID);
                                    
                                    while($row2 = mysql_fetch_array($subjects))
                                    {
                                        extract($row2);
                                        $subjectDetails=mysql_query("SELECT * FROM subject WHERE idSubject=".$idSubject."") or die('Could not connect: ' . mysql_error());
                                        $row3 = mysql_fetch_array($subjectDetails);
                                        extract($row3);
                                        echo "<p>$subjectName</p> ";
                                    }



                                    echo "<input type='hidden' value=".$idTeacher." name='teacherID'/>
                                    <input type='hidden' name='submitted' value='1'>    
                                    <br/><br/><center><input type='submit' id='saveTeach' class='addmore' value='Save' name='EditProfile'/>  </center>        
                                    </form>";
                                 
                                 
                                 $DBAccess->DBDisconnect();
                            ?>   
                                
                            </div>
			</div>
			<div class="footer">
				
				<p>&#169; Copyright &#169; 2011. Company name all rights reserved</p>
				<div class="connect">
					<a href=""><img src="images/paragox.png" width=160" height="110" alt=""/></a>
					<a href=""><img src="images/fblogo.png" width=120" height="100" alt="" style="position:relative; left:-31px"/></a>
					<a href=""><img src="images/harmony.png" width=120" height="100" alt="" style="position:relative; left:0px"/></a>
				</div>
			</div>
		</div>
	</body>
</html>  